<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w"%>
<!DOCTYPE html>
<HTML>
  <head>
<%@ include file="/platform/style.jsp"%>
<link rel="stylesheet" href="<%=path %>/plugins/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="<%=path %>/plugins/kindeditor/kindeditor.js"></script>
<script charset="utf-8" src="<%=path %>/plugins/kindeditor/lang/zh_CN.js"></script>
<script>
var editor;
$(function(){
	KindEditor.ready(function(K) {
		$("[name='content']").val($("[name='bean.content']").val());
		editor = K.create('[name="content"]', {
			allowFileManager : false,
			height:'300px',
			uploadJson : ctx+'/upload/fileupload?updir=info',
			items : [
				'fontname', 'fontsize', '|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline',
				'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
				'insertunorderedlist', '|', 'emoticons', 'image', 'link']
		});
	});
	window.setTimeout(changetype,800);
})
function changetype(){
	if($("[name='bean.type']").val()!='3'){
		editor.readonly(true);
	}else{
		editor.readonly(false);
	}
}
function seltitleimg(){
	var str=ctx+"/platform/upload/UploadPage.page?rootPath=info/&fileName="+$("input[name='bean.phototitle']").val();
	window.parent.parent.$w.openDialog({url:str,title:"选择图片",w:700,h:420,afterClose:function(revalue){
		if(revalue && revalue.fileName){
			$("input[name='bean.phototitle']").val(revalue.filePath+revalue.fileName);
			
		}
	}});
}
function tosave(){
	$("[name='bean.content']").val(editor.html());
	$w.doForm({callback:function(re){
		if(re.state=='ok'){
			window.parent.parent.$w.correctMsg("保存成功!");
			window.parent.$w.closeCurrWin("ok");
		}
	}});
}
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'center',border:false">	
	<form method="post" action="/information/InformationPage@update.page">
		<w:hidden bind="bean.id"/>
		<div class="ui-formContent" style="margin-top:2px;">
			<table border="0"  cellpadding="3" cellspacing="3">
				<w:switch>
				<w:case bind="#subchannels.size()>0">
				<tr>
				<td align="right">广告位置：</td>
				<td colspan="3"><select name="bean.code" style="width:300px;height:30px;"><w:options bind="bean.code" collection="#subchannels" value="code" text="name"/></select></td>
				</tr>
				</w:case>
				<w:else><w:hidden bind="bean.code"/></w:else>
				</w:switch>
				<tr>
				 <td align="right" width="90">标题：</td>
				 <td><w:text bind="bean.title" style="width:300px;"  styleClass="easyui-validatebox" dataOptions="required:true"/></td>
				 <td align="right" width="90">类型：</td>
				 <td ><select onchange="changetype()" name="bean.type" style="width:100px;height:30px;"><w:options bind="bean.type" dict="InformationTag"/></select></td>
				 </tr>
				 <tr>
				 <td align="right">标题图片：</td>
				 <td colspan="3"><w:text bind="bean.phototitle" style="width:242px;"/><a href="javascript:;" class="easyui-linkbutton" onclick="seltitleimg()">选择</a>
				 <w:equal bind="bean.code" value="003001"><span style="color:red">&nbsp;请上传高度为500px，宽度不低于1300px的图片</span></w:equal>
				 </td>
				 </tr>
				<tr>
				<td align="right">链接地址：</td>
				 <td><w:text bind="bean.url" style="width:300px;"/></td>
				 <td align="right">排序号：</td>
				 <td><w:text bind="bean.orderid" style="width:100px;" styleClass="easyui-numberbox"/></td>
				</tr>
				<tr>
				<td align="right">开始时间：</td>
				<td id="dddd"><w:text bind="bean.ISSUETIME" style="width:300px;height:30px;" styleClass="easyui-datetimebox"/></td>
				<td align="right">结束时间：</td>
				<td><w:text bind="bean.INVALIDTIME" style="width:300px;height:30px;" styleClass="easyui-datetimebox"/></td>
				</tr>
				<tr id="conedit">
				<td align="right" valign="top" style="padding-top:5px;">内容编辑：</td>
				<td colspan="3"><w:hidden bind="bean.content"/><textarea name="content" style="width:730px;height:200px;visibility:hidden;"></textarea></td>
				</tr>
			</table>
		</div>
	</form>
</div>
<div data-options="region:'south',border:false" style="height:34px;" class="ui-buttonBar">
	<a href="javascript:;" class="easyui-linkbutton marginR16" iconCls="icon_save" onclick="tosave()">保 存</a>
	<a href="javascript:;" class="easyui-linkbutton" iconCls="icon_cancel" onclick="window.parent.$w.closeCurrWin()">取 消</a>
</div>
</body>
</html>